Skip to content

Open SIFT demo data in binary mode#5213

Closed
massy-o wants to merge 3 commits into
facebookresearch:mainfrom
massy-o:codex/open-sift-demo-binary
Closed

Open SIFT demo data in binary mode#5213
massy-o wants to merge 3 commits into
facebookresearch:mainfrom
massy-o:codex/open-sift-demo-binary

Conversation

@massy-o
Copy link
Copy Markdown
Contributor

@massy-o massy-o commented May 14, 2026

Summary

  • open SIFT demo vector files with binary mode

Why

The SIFT demo reads .fvecs/.ivecs data as fixed-width binary records. Opening the file with rb avoids platform text-mode translation, especially on Windows, and keeps the byte-size checks aligned with the actual file contents.

Testing

  • git diff --check

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 14, 2026

Hi @massy-o!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Comment thread demos/demo_sift1M.cpp

float* fvecs_read(const char* fname, size_t* d_out, size_t* n_out) {
FILE* f = fopen(fname, "r");
FILE* f = fopen(fname, "rb");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: The demo treats .fvecs/.ivecs files as fixed-width binary records, so rb avoids platform text-mode translation before the size and fread assertions run.

@meta-cla meta-cla Bot added the CLA Signed label May 14, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 22, 2026

@alibeklfc has imported this pull request. If you are a Meta employee, you can view this in D106137008.

@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 23, 2026

@alibeklfc merged this pull request in ca87f41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants